<!-- 遮罩选择层 -->
<template>
  <div class="MaskSleBox-container">
    <Icon type="close" @click="closeMaskSel"></Icon>
    <div class="main" v-if="props.maskSelBox.length !== 0">
      <div class="item" v-for="item in maskSelBox" :key="item.id" @click="headleSelect(item)">
        <div
          v-for="(it, index) in item.value"
          :key="index"
          
        >
          <el-avatar
            v-if="it.attribute === 'avatar'"
            :size="60"
            :src="it.text"
          />
          <p v-else>
            <span class="label">{{ it.label }}</span
            ><span>:</span><span class="text">{{ it.text }}</span>
          </p>
        </div>
      </div>
      
    </div>
    <Unavailable v-if="!props.maskSelBox.length"></Unavailable>
    <div class="slot">
        <slot></slot>
      </div>
  </div>
</template>

<script setup>
import Icon from "@/components/Icon/index.vue";
import Unavailable from "@/components/Unavailable/index.vue";
const emit = defineEmits(["closeMaskSel", "MaskSelSelect"]);
const props = defineProps({
  maskSelBox: {
    type: Array,
    required: true,
  },
});

const closeMaskSel = () => {
  emit("closeMaskSel");
};
const headleSelect = (item) => {
  
  emit("MaskSelSelect", item);
};
</script>

<style lang="less" scoped>
@import "@/styles/var.less";
.MaskSleBox-container {
  background-color: rgba(255, 255, 255, 0.5);
  width: 100%;
  height: 100%;
  backdrop-filter: blur(5px);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  overflow: auto;
  .main {
    padding: 30px 0;
    width: 80%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 30px 30px;
    
  }
  .item {
    background-color: @white;
    height: 250px;
    border-radius: 5px;
    text-align: center;
    padding: 20px 0;
    box-shadow: 2px 2px 10px @gray;
    cursor: pointer;
    &:hover {
      transform: scale(1.02);
    }
    p {
      margin: 5px 0;
      span {
        margin: 0 1px;
      }
      .text {
        color: @second;
        font-weight: 600;
      }
    }
  }
  .label {
    text-align: justify;
    text-justify: distribute;
  }
  .slot {
    
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
}
.icon-container {
  font-size: 2em;
  border: 1px solid @text;
  position: absolute;
  right: 0;
  top: 0;
  cursor: pointer;
  &:hover {
    background-color: @danger;
    color: @white;
    border: none;
  }
}
</style>